<template>
  <ul>
    <li v-for="(item, index) in list" :key="'fn_' + index">
      <button @click="item.fn">{{ item.text }}</button>
    </li>
    <li>
      <input type="text" ref="lat" v-model="optInfo.lat" placeholder="lat">
      <input type="text" ref="lng" v-model="optInfo.lng" placeholder="lng">
      <button @click="flyTo">飞向（FlyTo）</button>
    </li>
  </ul>
</template>

<script>
export default {
  name: 'MapMenu',
  data() {
    return {
      list: [
        {
          text: '标记点',
          fn: () => {
            this.$emit('drawPoint')
          }
        }, {
          text: '画圆',
          fn: () => {
            this.$emit('drawCircle')
          }
        }, {
          text: '画矩形',
          fn: () => {
            this.$emit('drawPolygon')
          }
        }, {
          text: '画弹窗',
          fn: () => {
            this.$emit('drawPopur')
          }
        }, {
          text: '缩放地图（-）',
          fn: () => {
            this.$emit('smallMap')
          }
        }, {
          text: '放大底图(+)',
          fn: () => {
            this.$emit('bigMap')
          }
        }, {
          text: '嵌入视频',
          fn: () => {
            this.$emit('addVideoToMap')
          }
        }, {
          text: '清除',
          fn: () => {
            this.$emit('clearMap')
          }
        }, {
          text: '绘制折线',
          fn: () => {
            this.$emit('drawPolyLine')
          }
        }, {
          text: '雷达图',
          fn: () => {
            this.$emit('radar')
          }
        }, {
          text: '扫描某区域',
          fn: () => {
            this.$emit('drawRadarArea')
          }
        }, {
          text: '绘制动线',
          fn: () => {
            this.$emit('drawAnimationLine')
          }
        }, {
          text: '绘制半圆',
          fn: () => {
            this.$emit("testSemi")
          }
        }, {
          text: '测绘距离',
          fn: () => {
            this.$emit("drawLineDistance")
          }
        }
      ],
      optInfo: {
        lat: '',
        lng: ''
      }
    }
  },
  methods: {
    flyTo () {
      this.$emit("flyTo", this.optInfo)
    }
  }
}
</script>